02. Build Your Project
Outlined below is a suggested approach to building your project that will help you systematically meet all the requirements for this project.
We have also included a task list to help you keep track of which steps you have completed and which step you are currently working on.
Note: As long as your project submission meets all the requirements specified in the Project Rubric, you can build your project any way you like and also use different assets than the once provided with the starter project.
Project: A Maze - Task List
Task Feedback:
Congrats, you've done it. Time to prepare for submission!
01. Understanding the Project Requirements
During this step we will make sure we understand the scope of the project and what is required from our project submission. First make sure you read through all the project lesson pages:
- The Project Overview page (the previous page) provides a high level overview of what you will create, why you are creating the project, and what you are expected to learn from it.
- The Build Your Project page (this page) provides step-by-step instructions for how you can approach completing the project.
- The Prepare for Submission page provides information on how you submit your project to Udacity and also links to the Project Rubric.
- The Project: A Maze page is where you submit the project.
Important! All project submission requirements are specified in the Project Rubric. Project-related information provided on other project lesson pages is provided for context and guidance.
Project Preview:
02. Downloading and Opening the Starter Project
During this step we will download the starter project, verify that we have the recommended Unity version installed, and get to know the project and the scene.
- Go to the VR Software Development - A Maze repository release page and read the release notes and the README.
- Download the Source code (zip), or the Source code (tar.gz), for the most recent release version which will be noted as the Recommended Version in the Release Status section of the release notes.
- Unzip the repository to a convenient location on your computer.
- Open the Unity project named A Maze.
- Open the scene Assets > UdacityVR > Scenes > Main.
- Spend some time exploring the scene and the assets.
- Enter game mode.
Notice that there is no VR functionality yet. We will set that up in the next step when we create the GVR camera rig.
Important! Make sure you use the Unity version specified in the Versions Used section of the release notes and the README for the release you downloaded.
Note: When you enter game mode, you will see a NullReferenceException error thrown from the Waypoint.cs script. This is expected and is caused by the code referencing the main camera's parent game object which doesn't exist yet, we will set it up in the next step.
03. Creating the GVR Camera Rig
During this step we will create the VR camera by including the GvrEditorEmulator in the scene and configuring the camera.
- Add the GvrEditorEmulator prefab to the scene.
- Make the
Main Cameragame object a child of theGvrEditorEmulatorgame object. - Reset the
Main Cameragame object's Transform component. - Verify that the
Main Cameragame object has the TagMainCamera. - Move the
GvrEditorEmulatorgame object to a convenient location for development, for example, Position:0, 3, 35and Rotation:0, 180, 0. - Enter game mode and use Alt + Mouse movement and Ctrl + Mouse movement to rotate and tilt the camera viewing angle.
Notice that there is no interactivity yet. We will set that up in the next step when we prepare the scene for interaction.
Tip: If the view seems 'off' when you rotate and tilt the camera viewing angle during game mode, verify that the
Main Cameragame object's Transform component properties are set to the default values, i.e. Position:0, 0, 0, Rotation:0, 0, 0, and Scale:1, 1, 1.
04. Preparing the Scene for Interaction
During this step we will prepare the scene for interaction by setting up the reticle pointer, physics raycaster, and event system, and then test the included waypoint system.
Note: The
Waypointgame objects in the scene are instances of the Waypoint prefab which has already been completed for you.
- Add the GvrReticlePointer prefab to the scene as a child of the
Main Cameragame object.
- Increase the Max Reticle Distance value for the
GvrReticlePointerfrom the default10to20. - Add the GvrPointerPhysicsRaycaster script as a component on the
Main Cameragame object. - Add the GvrEventSystem prefab to the scene.
- Enter game mode and navigate the scene by clicking on the waypoints.
Notice that when you move the reticle pointer over any of the other game objects such as the Coin, Key, or Door, the reticle pointer does not expand and the game objects cannot be interacted with. We will set that up in the next step when we make the game objects interactive.
Tip: If the reticle pointer seems 'off' when you rotate and tilt the camera viewing angle during game mode, verify that the
GvrReticlePointergame object's Transform component properties are set to the default values, i.e. Position:0, 0, 0, Rotation:0, 0, 0, and Scale:1, 1, 1.
05. Making the Game Objects Interactive
During this step we will make the Coin, Key, and Door interactive by adding script and event trigger components to them.
- Locate and select the
Coingame object in the hierarchy.
- Verify that it has a Collider component.
- Add the provided Coin script as a component.
- Add an Event Trigger as a component.
- Add the PointerClick event to the Event Trigger component.
- Assign the Coin script component to the object field of the Pointer Click event.
- Assign the Coin.OnCoinClicked() method as the function for the Pointer Click event.
- Enter game mode, click on the coin and verify that the message
'Coin.OnCoinClicked()' was calledis printed to the Console window. - Repeat the same process for the
Keygame object but use the Key script and the Key.OnKeyClicked() method. - Repeat the same process for the first parent
Doorgame object but use the Door script and the Door.OnDoorClicked() method.
Notice that when you click, for example, the Coin the triggered event is not visible in the game view, but each time you click the Coin, the 'Coin.OnCoinClicked()' was called message is printed to the console window. This is because the OnCoinClicked() method has only been declared, i.e. it exist, but its definition, i.e. the executable code, currently only contains Debug.Log().
Note: In the provided scripts,
Debug.Log()has been added to each method we will be working on. This lets us quickly verify that the event system and event triggers are working correctly. Additionally, it helps inform us about which method is called and when, something that can be very helpful during development.
06. Making the UI Interactive
During this step we will make the SignPost interactive by adding script and event trigger components to it. The process is almost identical to what we did with the Coin, Key, and Door in the previous step, but we don't need a collider to interact with UI game objects. Instead, we need to verify that the Canvas game object has a Graphic Raycaster component, and because we are using GVR, we will replace Unity's Graphic Raycaster with Google VR's GvrPointerGraphicRaycaster.
Tip: Temporarily disable the
The_Temple, theDoor, and thePost_Signgame objects so you can easily see and navigate to the SignPost.
- Locate and select the
SignPostgame object in the hierarchy.
- Remove the Graphic Raycaster component that is automatically added when creating a new canvas game objects.
- Add the GvrPointerGraphicRaycaster script as a component.
- Add the provided SignPost script as a component.
- Add an Event Trigger as a component.
- Add the PointerClick event to the Event Trigger component.
- Assign the SignPost script component to the object field of the Pointer Click event.
- Assign the SignPost.ResetScene() method as the function for the Pointer Click event.
- Enter game mode, click on the SignPost and verify that the message
'SignPost.ResetScene()' was calledis printed to the Console window.
At this point you have a scene with several game objects that when clicked will call the specified method in the script assigned to the Pointer Click event trigger. During the next four steps we will write code to create 'behaviours' for the Coin, Key, Door, and SignPost game objects.
07. Programming the Coin Behaviour
During this step we will program the Coin behaviour so that when a Coin is clicked it plays a sound, displays a 'poof' effect, and disappears.
- Review the Coin Behaviour section of the Project Rubric.
- Open the Coin script and read through the entire script including all the comments.
- Spend some time understanding the behaviour of the provided CoinPoof prefab. You can do this by, for example, entering game mode and dragging a CoinPoof prefab into the scene.
- Program the Coin behaviour by completing all the TODO comments in the script.
Tip: Each commented line immediately underneath the TODOs represents one line of code. (Not including lines with only opening or closing curly brackets).
Note: The provided CoinPoof prefab has already been completed and does not need to be modified.
Project Preview:
08. Programming the Key Behaviour
During this step we will program the Key behaviour so that when the Key is clicked it plays a sound, displays a 'poof' effect, and disappears.
- Review the Key Behaviour section of the Project Rubric.
- Open the Key script and read through the entire script including all the comments.
- Spend some time understanding the behaviour of the provided KeyPoof prefab. You can do this by, for example, entering game mode and dragging a KeyPoof prefab into the scene.
- Program the Key behaviour by completing all the TODO comments in the script.
Tip: Each commented line immediately underneath the TODOs represents one line of code. (Not including lines with only opening or closing curly brackets).
Note: The provided KeyPoof prefab has already been completed and does not need to be modified.
Project Preview:
09. Programming the Door Behaviour
During this step we will program the Door behaviour so that when the Key is clicked the Door is unlocked and when the Door is clicked it plays a sound and starts rotating to an open position.
- Review the Door Behaviour section of the Project Rubric.
- Open the Door script and read through the entire script including all the comments.
- Add an AudioSource component to the first parent
Doorgame object and disable Play On Awake. - Assign the Door_Opening audio to the AudioClip field.
- Program the Door behaviour by completing all the TODO comments in the script.
Tip: Each commented line immediately underneath the TODOs represents one line of code. (Not including lines with only opening or closing curly brackets).
10. Programming the SignPost Behaviour
During this step we will program the SignPost behaviour so that when the SignPost is clicked it restarts the game.
- Review the SignPost Behaviour section of the Project Rubric.
- Open the SignPost script and read through the entire script including all the comments.
- Program the SignPost behaviour by completing all the TODO comments in the script.
Tip: Each commented line immediately underneath the TODOs represents one line of code. (Not including lines with only opening or closing curly brackets).
Note: If you haven't already, now is a good time to disable Auto Generate and manually Generate Lighting (located at the bottom of the Lighting window).
At this point you have created a fully interactive multisensory VR project!
Tip: For extra practice with animations, you might want to make the Chest interactive and animate the lid opening when the user clicks it. Because this is not not a requirement specified in the Project Rubric, you can create the animation using only code or use an animation and animator controller. If you want to use an animator controller, you can either create your own animation clip or import the animation from the Chest model.
Project Preview:
11. Creating the Gameplay Functionality
During this step we will put everything together and turn our project into an actual game.
- Review the Gameplay Functionality section of the Project Rubric.
- Use the child game objects of the
Mazegame object to design a Maze. - Move the player, i.e. the
GvrEditorEmulatorgame object, to your desired start location. - Add more Waypoints so the player can navigate to all parts of the Maze.
- Add more Coins so the player have plenty of Coins to collect.
- Move the
Keyto a location so it is somewhat difficult for the player to find it. - Add walls (cubes) to ensure that users have to navigate around to find the key and coins.
Tip: Any time you have a game object that you want to reuse multiple times such as for example the Coin game object and the game objects you use to build the Maze, you want to turn the game object into a Prefab before duplicating it because this allows you to make changes to all the copies at the same time.
Project Preview:
12. Update the README file
Create a README.txt or README.md file if one doesn't exist yet. Be sure to add the following information to the file.
- Description of the submitted project
- Name of the main scene, i.e. the scene that should be loaded first
- Name of all other scenes that that should be reviewed, if any
- Unity version used
- GVR SDK for Unity version used
- Target deployment platform(s)
Project Preview:
13. Improve, Deploy, Test, and Optimize
Although this step is not necessary to meet the Project Rubric requirements, it provides a great opportunity to practice and deepen our understanding of what we learned in the previous course, VR Scenes & Objects.
It is also extremely important to create experiences that people actually enjoy. At a minimum, this includes making sure the app runs smoothly on the target device but we can also do some other enhancements to our scene. Here are some suggestions:
- Replace the default Skybox (a Skybox material is provided in the Assets folder).
- Add ambient sound (an audio clip is provided in the Assets folder).
- Add lights to highlight important parts of the scene.
- Adjust lights, materials, and lighting settings to reflect the atmosphere you want the game to convey.
- Optimize game objects, lights, materials, lighting settings and quality settings for mobile VR.